<?php
/**
 * User: lie
 * Date: 2020/11/5 10:30
 * description:
 */

    echo "<form action='045.php' method='post'>";
    echo "数字口令：<input name='text' type='text'>";
    echo "<input type='submit' name='sub' value='确定'>";
    echo "</form>";
    define("PI", 3.1415926);
    function Encrypt($str){
        return $str = $str + PI;
    }

    function Decrypt($str){
        return  $str = $str - PI;
    }

    if ($_POST['sub']){
        echo "加密口令：".Encrypt($_POST['text']);
        $_SESSION['pwd'] = Encrypt($_POST['text']);


    ?>

    <a href="045.php?pwd=1">解密口令</a>
<?php
    }
    if (isset($_GET['pwd'])){
        echo "解密口令：".Decrypt($_SESSION['pwd']);
    }

    var_dump($_POST['sub']);
?>